var FEEDBACK = {
    dm:window.document,
    dialog:null,
    isinterview: null,
    tab: 0,
    typeArr:[1,10,22,356,4],
    init: function () {
        this.setPopup();
        this.bindEvent();
    },
    /**
     * 普通职位和反馈通两个tab共用一个js，部分绑定在普通职位里不起作用
     */
    bindEvent: function () {
        $(FEEDBACK.dm).on('click','.fedback_gz',function (e) {//获取消息详情
            var $that =e.target.nodeName.toLocaleLowerCase()=='span'? $(e.target):$(e.target).parent();
            var recordid =$that.data('recordid');
            var data = "id=" + recordid
                + "&relateid=" + $that.data('jobid') + "_" + $that.data('reid')
                + "&time=" + $that.data('time')
                + "&type=" + $that.data('type')
                + "&modified=" + $that.data('modified')
                + "&utype=" + $that.data('utype')
                + "&jobNum=" + $that.data('jobnum')
                + "&resumename=" + encodeURIComponent($that.data('resumename'))
                + "&companyid=" + $that.data('companyid')
                + "&jtitle=" + encodeURIComponent($that.data('jtitle'))
                + "&resumenum=" + $that.data('resumenum')
                + "&positiontype=" + $that.data('positiontype');

            if($('.fb_list_interview').length==0) {
                FEEDBACK.isinterview=recordid;
                /*投递状态详细信息等待效果*/
                $('#recordid_' + recordid).after('<div class="fb_list_interview" style="display: block;text-align:center;"><img src="http://img01.zhaopin.cn/2014/i/img/feedback/loading.gif" style="height:30px;width:30px;margin-top:15px;"></div>');
                submitCallback(data,'_GetJobMsg',FEEDBACK.getMsgResponse,'post',$that);
            }else{
                if(FEEDBACK.isinterview!=recordid){
                    $('#img_'+FEEDBACK.isinterview).attr('src','http://img01.zhaopin.cn/2014/c/img/feedback/arrow_down.jpg');
                    FEEDBACK.isinterview=recordid;
                    /*投递状态详细信息等待效果*/
                    $('.fb_list_interview').remove();
                    $('#recordid_' + recordid).after('<div class="fb_list_interview" style="display: block;text-align:center;"><img src="http://img01.zhaopin.cn/2014/i/img/feedback/loading.gif" style="height:30px;width:30px;margin-top:15px;"></div>');
                    submitCallback(data,'_GetJobMsg',FEEDBACK.getMsgResponse,'post',$that);
                }else{
                    $('#img_'+recordid).attr('src','http://img01.zhaopin.cn/2014/c/img/feedback/arrow_down.jpg');
                    $('.fb_list_interview').remove();
                    /*收起投递状态详细信息时如果存在定时器则关闭该定时器*/
                    if(feedback_c_d.idTimer){
                        clearInterval(feedback_c_d.idTimer);
                    }
                }
            }
        }).on('click','.page_list a',function (e) {//分页跳转
                var sumCount = $(this).data('jump');
                var tab =FEEDBACK.tab;
                var type =FEEDBACK.typeArr[tab];
                FEEDBACK.showStatus = false;
                if(sumCount){
                    var $page = $('#pageNum');
                    var pageNum = $page.val();
                    if(pageNum!="" && pageNum>0){
                        $page.attr('class','border_default');
                        pageNum = pageNum>sumCount?sumCount:pageNum;
                        FEEDBACK.setMask();
                        FEEDBACK.setRecordRequest(FEEDBACK.tab,pageNum,type);
                    }else{
                        $page.attr('class','border_red');
                        window.location.hash ="#pageNum";
                        e.preventDefault();
                    }
                }else{
                    pageNum = $(this).data('pagenum');
                    var sum = $('.sumnum').html()*1;
                    if(pageNum <= sum && pageNum > 0){
                        FEEDBACK.setMask();
                        FEEDBACK.setRecordRequest(FEEDBACK.tab,pageNum,type);
                    }
                }
            }).on('click','#setTab li',function (e) {//tab页切换
                FEEDBACK.showStatus = true;
                FEEDBACK.setTab($(this));
            }).on('click','#Screening',function(e){//筛选条件
                if($('#ul-screening').is(':hidden')){
                    $(this).addClass('Screening_cur');
                    $('#ul-screening').show();
                    return;
                }
                var tab = FEEDBACK.tab;
                FEEDBACK.showStatus = false;
                if(e.target.nodeName.toLowerCase()=='li'){
                    var id =$(e.target).data('id');
                    FEEDBACK.typeArr[tab] = id==0 ? 356 : id;
                    $('#span-screening').html($(e.target).html());
                    var $that =$($('#setTab li')[tab]);
                    FEEDBACK.setTab($that);
                }
                $(this).removeClass('Screening_cur');
                $('#ul-screening').hide();
            })/*.on('click','.user_btn_no,.user_btn_yes',function (e) {//面试意向请求  //做到面功能时被注释
                var $that = $(e.target);
                var data = 'type='+$that.data('type')+'&companyId='+$that.data('companyid')+'&rootid=' + $that.data('rootid') + '&id=' + $that.data('id') + '&relateId=' + $that.data('relateid') +
                    '&gids=' + $that.data('gids') +'&jtitle=' + encodeURIComponent($that.data('jtitle')) + "&jobNum=" + $that.data('jobnum')+ "&resumenum=" + $that.data('resumenum');

                //拒绝邀请时显示原因选择窗口以及遮罩
                if($that.hasClass('user_btn_no')){
                    feedback_popup.popShow({'target': $that, 'data' : data});
                }else{
                    submitCallback(data,'UpdateMsgStatus',FEEDBACK.getSubmitResponse,'post',$that);
                }
            })*/.on('click','.closediv',function () {
                FEEDBACK.dialog.onclose();
            });
    },
    setTab: function ($that) {
        if ($that && $that.length == 1) {
            var id = $that.data('id');
            if (FEEDBACK.tab != id) {
                $('#span-screening').html('筛选');
                FEEDBACK.typeArr = [1,10,22,356, 4];
            }
            var type = FEEDBACK.typeArr[id];
            var $screening = $('#Screening');
            $('#ul-screening').hide();
            FEEDBACK.tab = id;
            $('#setTab li').removeClass('hover');
            $that.addClass('hover');
            $("#Screening").removeClass("Screening_cur");
            switch (id) {
                case 3:
                    $('#ul-screening li.tab0').remove();
                    $screening.show();
                    break;
                case 0:
                case 1:
                case 2:
                case 4:
                    $screening.hide();
                    break;
            }
            FEEDBACK.setMask();
            FEEDBACK.setRecordRequest(id, 1, type);
        }
    },
    setMask : function (){
        $('.popdiv').remove();
        var $recordlist = $('#recordlist');
        var offset = $recordlist.offset();
        $('#recordlist').html($('#recordlist').html()+'<div class="popdiv" style="width:'+$recordlist.width()+'px;height:'+$recordlist.height()+'px;left: '+offset.left+'px;top: '+offset.top+'px;"><img src="http://img01.zhaopin.cn/2014/i/img/feedback/loading.gif" class="poploading"></div>');
    },
    setPopup : function () {
        FEEDBACK.showStatus = true;
        var $that = $('#setTab li').eq(0);
        /*当浏览器地址栏的URL中包含tab=3时，显示面试邀请的tab*/
        if(window.location.search.indexOf('tab=3') != -1){
            $that = $('#setTab li').eq(3);
        }
        FEEDBACK.setTab($that);
    },
    setMsgCount:function (id) {
        if($('#'+id).length>0){
            var tabArr = $('#'+id).val().split('|');
            var	len=tabArr.length;
            for(var i =0;i<len;i++){
                var cls=tabArr[i]=='0'?'':'new_news';
                $('#nownews'+i).attr('class',cls);
            }
        }else{
            /*去掉没有记录的tab的红点*/
            $('#nownews'+FEEDBACK.tab).removeClass('new_news');
        }
    },
    setRecordRequest : function (tab,pageNum,type) {
        var data = "tab="+tab+"&type="+type+"&pageNum="+pageNum;
        submitCallback(data,'_JobPostHistory',FEEDBACK.getRecordResponse,'post',$('#recordlist'));
    },
    getRecordResponse:function (success,responseText,$obj) {
        if(success){
            $obj.html(responseText);
            FEEDBACK.setMsgCount('msgcount');
            /*执行竞争力相关的方法*/
            initMZPModule();
            /*简历排队获取数据时的等待效果*/
            $('.row_box span').html('<img src="http://img01.zhaopin.cn/2014/rd2/img/loading-small.gif" style="display:block;float:left;margin:6px 0 0 56px;">');
            /*因为当返回responseText在页面中加载后，下面的操作才能获取到数据，为保证请求返回数据的正确，所以做延迟处理*/
            setTimeout(function(){
                /*点击tab时展开每个tab第一页第一条记录的状态*/
                if(FEEDBACK.showStatus){
                    $('.fedback_gz').eq(0).click();
                }
                /*简历排队数*/
                feedback_c_d.previousResumeCount();
                /*"简历排队"按钮绑定事件*/
                feedback_c_d.refPreResCount();
            }, 50);
        }
    },
    getMsgResponse:function (success,responseText,$obj) {
        if(success){
            $('#img_'+$obj.data('recordid')).attr('src','http://img01.zhaopin.cn/2014/c/img/feedback/arrow_up.jpg');
            $('.fb_list_interview').remove();
            /*没有返回数据时显示提示*/
            if(responseText == ''){
                responseText = '<div class="fb_list_interview" style="display: block;text-align:center;">没有返回正确的数据</div>';
            }
            $('#recordid_'+$obj.data('recordid')).after(responseText);
            FEEDBACK.setMsgCount('tab');
            /*当tab为0即tab是投递成功时需要删除返回的responseText中多余的class为fb_time_msg_line的div*/
            if(FEEDBACK.tab == 0){
                $('.fb_time_msg_line').remove();
            }
            /*添加新投递状态详细信息时如果存在定时器则关闭该定时器*/
            if(feedback_c_d.idTimer){
                clearInterval(feedback_c_d.idTimer);
            }
            /*给投递状态详细信息中的按钮绑定事件 $obj是被点击的投递状的$对象*/
            feedback_c_d.eventBindMsgBtn($obj);
            /*判断是否有"提醒HR尽快查看"或"提醒HR尽快联系我"按钮，并且data-time是否有值*/
            if($('.remind_btn').length > 0 && $('.remind_btn').data('time')){
                feedback_c_d.remindBtnTiming($('.remind_btn'), 'response');
            }
            /*调节ie7地点内容位置兼容*/
            $(".msg_wrap div").eq(2).height($(".msg_wrap div").eq(2).find(".path").height());
            $(".msg_wrap div").eq(5).height($(".msg_wrap div").eq(5).find("small").height());
            //设置信息的颜色以及计算信息边线长度
            $(".fb_time_msg_con p:first").addClass("firstP");
            $(".fb_time_msg_con p").eq(1).next().addClass("ash");
            var lineHeight = $(".fb_time_msg_con").height()-31;
            $(".fb_time_msg_line").height(lineHeight);
            //判断是否有乘车线路按钮
            if($('.path_way').length > 0){
                $('.path_way').on('click', function(){
                    var $this = $(this), address = $this.parent('.path').html().replace(/<font.*?<\/font>/i, '');
                    feedbackMapWinInit(address);
                    //数据统计埋点
                    dyweTrackEvent('feedbackMessageDetails','clickMapDialogLink');
                });
            }
        }
    },
    getSubmitResponse :function (success,responseText,$obj) {
        if(success){
            if(typeof JSON == 'undefined'){
                $.getScript("http://img01.zhaopin.cn/2014/common/js/json2.js",function(){
                    FEEDBACK.resetInterview(responseText,$obj,true);
                });
            }else{
                FEEDBACK.resetInterview(responseText,$obj,false);
            }
        }
    },
    resetInterview : function (responseText,$obj,isie6){
        /*responseText的值{"flag":true,"modified":"2015-06-17 11:55"}*/
        var data = JSON.parse(responseText);
        /*由于和落地页的是同一个请求而落地页需要判断flag的值来显示不同的结果，这里操作后显示的结果都一样所以去掉此处的判断*/
        if(data!= null/* && data.flag*/){
            var cls = "", tips = "", tips2 = "", time = data.modified, $status_record = $('span[data-recordid=' + $obj.data("id") +']'), $status_html = $status_record.html(), refuse_reason = '';
            /*改变该record中按钮“邀请面试”的状态为接受邀请或拒绝邀请*/
            if($obj.data("type")=="5"){
                cls = "bright";
                tips = "接受";
                $status_record.data('type', 5);
                $status_record.html($status_html.replace('邀请面试', '接受邀请'));
                tips2 = '更多相似职位';
            }else{
                cls = "cross";
                tips = "拒绝";
                $status_record.data('type', 6);
                $status_record.html($status_html.replace('邀请面试', '拒绝邀请'));
                tips2 = '更多靠谱职位';
                refuse_reason = $obj.data('reason') ? ' 拒绝原因：' + $obj.data('reason') : '';
            }
            $status_record.data('time', data.modified);
            $status_record.siblings('.fedback_time').html(data.modified);
            /*改变投递状态*/
            $(".fb_time_line>div").eq(4).removeClass('gay').addClass(cls).find('span').text(tips + '邀请');
            var htmlStr = '<p class="firstP"><span>' + time + '</span><em>你已' + tips +'企业的面试邀请' + refuse_reason + '</em></p>' +
            '<div class="btn_wrap"><a class="more_btn" href="http://i.zhaopin.com/Recommend/GotoSimilarPosition/GetPositionPara?jobExtId='+ $status_record.data('jobnum') +'&r=a">' + tips2 + '</a></div>';
            /*把以前的信息设置成灰色，并添加新的信息*/
            $('.fb_time_msg .fb_time_msg_con p').eq(0).removeClass('firstP');
            $('.fb_time_msg .fb_time_msg_con .msg_wrap').addClass('ash');
            $('.fb_time_msg .fb_time_msg_con').prepend(htmlStr);
            /*删除暂不考虑和接受邀请按钮*/
            $('.user_wrap').remove();
            /*调节ie7地点内容位置兼容*/
            $(".msg_wrap div").eq(2).height($(".msg_wrap div").eq(2).find(".path").height());
            $(".msg_wrap div").eq(5).height($(".msg_wrap div").eq(5).find("small").height());
            /*重新计算左侧边线的长度*/
            var lineHeight = $(".fb_time_msg_con").height()-31;
            $(".fb_time_msg_line").height(lineHeight);
        }
    },
    getPopupResponse: function (success,responseText,$obj) {
        if(success){
            try{
                FEEDBACK.dialog = new ZPIDC.dialog({
                    title:  '',
                    width: 686,
                    height: 'auto',
                    containerid: "window_result_dialog",
                    isMask: true,
                    headerHeight : 0,
                    containerCls : 'fb_company_list_popdiv',
                    bodyCls : 'fb_company_list'
                });
                responseText = responseText.replace('fb_list_interview', 'fb_list_interview72').replace('fedback_gz', 'fedback_gz72');
                FEEDBACK.dialog.optionBody($(responseText).children().children());
                setTimeout(function(){
                    /*弹出窗口中如果有"竞争力"则给该"竞争力"单独调用创建竞争力对象的方法创建一个对象并添加在对应的数组中，创建对象时需要该竞争力的dom对象*/
                    if($('#window_result_dialog [mzpmodule="resumeViewNumFac"]').length > 0){
                        window['mzpModuleIns'][$('#window_result_dialog [mzpmodule="resumeViewNumFac"]').attr('id')] = new window['resumeViewNumFac']($('#window_result_dialog [mzpmodule="resumeViewNumFac"]')[0]);
                    }
                    /*如果弹窗的top小于0则设置为5*/
                    parseInt($('#window_result_dialog').css('top')) <= 0 ? $('#window_result_dialog').css('top', '5px') : '';
                    //设置信息的颜色以及计算信息边线长度
                    $(".fb_time_msg_con p:first").addClass("firstP");
                    $(".fb_time_msg_con p").eq(1).next().addClass("ash");
                    var lineHeight = $(".fb_time_msg_con").height()-31;
                    $(".fb_time_msg_line").height(lineHeight);
                },50);
            }catch(e){
                //console.log(e)
            }
        }else{
            try{
                FEEDBACK.dialog = new ZPIDC.dialog({
                    title:  '',
                    width: 686,
                    height: 'auto',
                    containerid: "window_result_dialog",
                    isMask: true,
                    headerHeight : 0,
                    containerCls : 'fb_company_list_popdiv',
                    bodyCls : 'fb_company_list'
                });
                FEEDBACK.dialog.optionBody($('<div class="fb_company_list_popdiv"><div class="fb_company_list"><div class="closediv close01"></div><div class="closebox">提示</div><p class="padErroe">加载失败，<a href="http://i.zhaopin.com/PositionRecord/jobpostrecord/index">刷新</a>页面试一试！</p></div></div>'));
            }catch(e){
                //console.log(e)
            }
        }
        FEEDBACK.setTab($obj);
    }
}
FEEDBACK.init();

/* 反馈通D期C端增加代码 2015-06-04 */
var feedback_c_d = {
    idTimer : '',
    eventBindMsgBtn : function($ele){
        /*"提醒HR尽快查看"或"提醒HR尽快联系我"按钮绑定事件*/
        if($('.remind_btn').length > 0){
            $('.remind_btn').off('click').on('click', function(){
                var $a = $(this);
                if($a.hasClass('remind_btn_clock')){
                    return;
                }
                data = "CompanyId=" + $a.data('companyid') + "&type=" + $a.data('type') + "&relateid=" + $a.data('relateid')
                + "&jtitle=" + encodeURIComponent($a.data('jtitle'))+ "&rootid=" + $a.data('rootid') + "&gIdS=" + $a.data('gids') + "&jobNum=" + $a.data('jobnum')+ "&resumenum=" + $a.data('resumenum')
                + ($a.attr('id') == 'remind_btn01' ? ("&createTime=" + $a.data('createtime')) : ''),
                callback = function(success, responseText, $ele){
                    //提醒成功后显示智联币奖励以及推荐职位弹窗
                    $.resultDialog(responseText);
                };
                /*发送请求，不需要返回新的状态*/
                submitCallback(data,'UserSendRemiderMsg',callback,'post',$a);
                /*点击后设置定时器*/
                feedback_c_d.remindBtnTiming($a, 'click');
            });
        }
    },
    remindBtnTiming : function($a, type){/*提醒按钮定时器*/
        var $a_id = $a.attr('id'), wait_time = 0, tip = '', click_wait_time = '';
        if($a_id == 'remind_btn01'){//按钮：提醒HR尽快查看
            wait_time = 3600;//可再次提醒的等待时间1小时即3600秒
            tip = '提醒HR尽快查看';
            click_wait_time = '60:00';
        }else if($a_id == 'remind_btn02'){//按钮：提醒HR尽快联系我
            wait_time = 21600;//可再次提醒的等待时间6小时即21600秒
            tip = '提醒HR尽快联系我';
            click_wait_time = '360:00';
        }
        if(type == 'response'){
            var time = $a.data('time');
            time = (new Date() - new Date(time))/1000;//秒
            /*服务器可能比本地的时间快导致time可能小于0*/
            time = time > 0 ? time : 1;
            /*如果上次点击提醒的时间没有超过一小时即60分钟，则设置按钮不可点击，并计时*/
            if(wait_time - time > 0){
                var m = Math.floor((wait_time - time)/60),//分钟
                s = ('' + Math.floor((wait_time - time)%60)).substr(0, 2);//秒
                setTimer($a, m + ':' + (Number(s) > 9 ? s : ('0' + s)), tip);
            }
        }
        if(type == 'click'){
            setTimer($a, click_wait_time);
            /*点击按钮"提醒HR尽快查看"或"提醒HR尽快联系我"弹出提醒成功效果*/
            /*$(".remind_success").stop().fadeIn(100).animate({"top":-120},400,function(){
                $(this).delay(500).fadeOut(300).animate({"top":-80},10);
            });*/
        }
        function setTimer($a, t, tip){
            $a.addClass('remind_btn_clock');
            var change_time = t;
            intervalCallback();
            var timer = setInterval(function(){
                intervalCallback();
            },1000);
            function intervalCallback(){
                if(change_time){
                    var m = change_time.split(':')[0], s = change_time.split(':')[1];
                    /*最后一秒时就要结束计时*/
                    if(Number(m) > 0 || Number(s) > 1){
                        if(Number(s) > 0 ){
                            s = Number(s) > 10 ? Number(s) - 1 : '0' + (Number(s) - 1);
                        }else{
                            m = Number(m) > 10 ? Number(m) - 1 : '0' + (Number(m) - 1);
                            s = '59';
                        }
                        change_time = m + ':' + s;
                        /*如果超过60分钟就添加小时*/
                        var h = '';
                        if(Number(m)/60 > 1){
                            h = Math.floor(Number(m)/60);
                            m = m - h * 60;
                            m = m > 9 ? m : '0' + m;
                        }
                        $a.html((h ? (h + ':'):'') + m + ':' + s +' 后可再次提醒');
                    }else{
                        clearInterval(feedback_c_d.idTimer);
                        $a.removeClass('remind_btn_clock');
                        /*"提醒HR尽快查看"或"提醒HR尽快联系我"*/
                        $a.html(tip);
                        change_time = '';
                    }
                }else{
                    clearInterval(feedback_c_d.idTimer);
                }
            }
            feedback_c_d.idTimer  = timer;
        }
    },
    pageRemind : function(){/*未开通反馈通用户，申请记录页面中显示开通提示*/
        if($('.dredge_module_wrap').length > 0){
            var divRemind = $('.dredge_module_wrap');
            divRemind.find('.dredge_module span').on('click', function(){
                var data = '',
                    callback = function(success, response, $ele){
                        if(success){
                            /*点击按钮"提醒HR尽快查看"或"提醒HR尽快联系我"弹出提醒成功效果*/
                            $(".dredge_success").stop().fadeIn(100).animate({"top":16},400,function(){
                                $(this).delay(600).fadeOut(300).animate({"top":82},10,function(){
                                    /*刷新当前页面*/
                                    window.location.reload(true);
                                });
                            });
                        }
                    }
                submitCallback(data,'http://i.zhaopin.com/feedback/api/set',callback,'post', divRemind);
            });
        }
    },
    remindResume72 : function(){
        /*查看是否有72小时未被查看的简历{Count：1，relateid:"31139270640_227670792"}*/
        var data = '',
        callback = function(success, responseText){
            if(success){
                /*获取72小时提醒消息*/
                responseText = eval('(' + responseText + ')');
                if(responseText.Count > 0){
                    var data = "relateid=" + responseText.relateid + "&type=23";
                    submitCallback(data,'Msginfo',FEEDBACK.getPopupResponse,'post','');
                    /*设置cookie，标志已显示过72小时未被查看提示窗口*/
                    jQuery.cookie('isAlreadyShow72',1,{domain:'.zhaopin.com',path:'/',expires:1});
                }
            }
        };
        submitCallback(data,'GetUnReadWarnMsgCount',callback,'post','');
    },
    previousResumeCount : function(){/*简历排队*/
        /*只有在开通了反馈通并且是投递成功tab时（只有在投递成功tab时才有$('.row_box span')）才需要发送该请求*/ //所有用户都认为是反馈通用户
        if(/*('' + jQuery.cookie('JSfeedback')).toLowerCase() == 'y' && */$('.row_box span').length > 0){
            var $span = $('.row_box span'),data = '',
            callback = function(success, responseText, $span){
                responseText = success ? responseText : '';
                var arr = responseText ? responseText.split(',') : [];
                for(var i = 0, len = arr.length; i < len; i++){
                    $span.eq(i).html(arr[i] <= 999 ? arr[i] : '999+');
                }
            };
            $span.each(function(index, ele){
                data += '{"ResumeNumber":\"' + $(ele).data('resumenumber') + '\","CreateDate":\"' + $(ele).data('createdate') + '\","JobNumber":\"' + $(ele).data('jobnumber') + '\"},';
            });
            data = data.replace(/,$/, '');
            data = 'jsons={ResumewailtList:[' + data + ']}';
            /*加载申请记录后发送请求获取该职位的简历排队数*/
            submitCallback(data,'GetAllWait',callback,'post',$span);
        }
    },
    refPreResCount : function(){
        /*"简历排队"按钮绑定事件*/
        $('.row_box i').on('click', function () {
            /*如果上一次请求还没有获得响应则在再次点击时直接返回*/
            if($(this).siblings('span').find('img').length != 0){
                return;
            }
            var $i = $(this), $span = $i.siblings('span'),
            data = "CompanyId=" + $span.data('companyid') + "&CreateDate=" + $span.data('createdate') + "&JobNumber=" + $span.data('jobnumber') + "&ResumeNumber=" + $span.data('resumenumber'),
            callback = function(success, responseText,$ele){
                responseText = success ? responseText : 0;
                $ele.html(responseText <= 999 ? responseText : '999+');
            };
            /*简历排队获取数据时的等待效果*/
            if($span.find('img').length == 0){
                $span.html('<img src="http://img01.zhaopin.cn/2014/rd2/img/loading-small.gif" style="display:block;float:left;margin:6px 0 0 56px;">');
            }
            /*发送请求获取新的数据*/
            submitCallback(data,'GetResumeWait',callback,'post',$span);
            /*点击时显示提示*/
            if($(this).siblings('.add_show').length == 0){
                var add_str = "<div class='add_show'>刷新成功</div>";
                $(this).parent().append(add_str);
            }
            $(this).siblings(".add_show").stop().fadeIn(100).animate({"top":-40},400,function(){
                $(this).delay(600).fadeOut(300).animate({"top":-22},10)}
            )
        });
    }
}
/*在开通了反馈通后才执行下面的方法*/
if(('' + jQuery.cookie('JSfeedback')).toLowerCase() == 'y'){
    /*72小时未被查看简历提示窗口一天只弹出一次，如果isAlreadyShow72有值则不再弹出提示*/
    if(jQuery.cookie('isAlreadyShow72') == null){
        feedback_c_d.remindResume72();
    }
}
/*在没有开通了反馈通时才执行下面的方法*/
if(('' + jQuery.cookie('JSfeedback')).toLowerCase() != 'y'){
    feedback_c_d.pageRemind();
}
/*反馈通D期，拒接面试邀请理由弹窗 2015-08-06*/
var feedback_popup = {
    createPop : function(){
        $('body').append('<div class="mainBlock" id="popupInnerContentspr">' +
            '<p class="refuse_title">拒绝原因<span id="btn_close"></span></p>' +
            '<div class="refuse_list">' +
            '<ul>' +
            '<li><input type="radio" name="resufeType" value="1" id="resufeType1"><label for="resufeType1">路程较远</label></li>' +
            '<li><input type="radio" name="resufeType" value="2" id="resufeType2"><label for="resufeType2">薪水差距较大</label></li>' +
            '<li><input type="radio" name="resufeType" value="3" id="resufeType3"><label for="resufeType3">福利太少</label></li>' +
            '<li><input type="radio" name="resufeType" value="4" id="resufeType4"><label for="resufeType4">行业不匹配</label></li>' +
            '<li><input type="radio" name="resufeType" value="5" id="resufeType5"><label for="resufeType5">项目不吸引人</label></li>' +
            '<li><input type="radio" name="resufeType" value="0" id="resufeType6"><label for="resufeType6">其他不匹配</label></li>' +
            '</ul>' +
            '<div class="reason">' +
            '<input type="text" name="resufeContent" id="resufeContent" class="refuse_input" value="' + this.contentTip + '">' +//类名为deep时为深色
            '<p class="reasonMore">最多可输入100个字符！</p>' +
            '<p class="reasonLess">至少要选择一项！</p>' +
            '</div>' +
            '</div>' +
            '<div id="btn_wrap2" class="btn_wrap2">' +
            '<input type="button" class="reasonBtn" value="确 定" name="btn_ok" id="btn_ok"/><span id="refuse_no_reason" onclick="dyweTrackEvent(\'feedbackRefuseOption\',\'clickRefuse\')">不选原因，直接拒绝</span>' +
            '</div>' +
            '</div>');
    },
    createMask : function(){
        $('body').append('<div class="mask_div_reason" style="height: '+ $(document).height() +'px;width: ' + $(document).width() + 'px;position: absolute;top: 0;left: 0;background-color: #7f7f7f"></div>');
    },
    dataObj : null,
    contLength : 100,//100个字符
    contentTip : '请输入拒绝原因，不得超过100个字符',
    popShow : function(paramData){
        this.createMask();
        this.createPop();
        $('#popupInnerContentspr').css({'z-index' : 203});
        $('.mask_div_reason').css({'z-index' : 202, 'opacity' : 0.5});
        this.setPosition();
        this.addEvent();
        this.dataObj = paramData;
    },
    setPosition : function(){
        if($('#popupInnerContentspr').is(':visible')){
            var h = $(window).height(), w = $(window).width(), s_t = $(window).scrollTop();
            var pop_h = $('#popupInnerContentspr').height(), pop_w = $('#popupInnerContentspr').width();
            $('#popupInnerContentspr').css({position: 'absolute', top: s_t + (h - pop_h)/2, left: (w - pop_w)/2});
            $('.mask_div_reason').css({height: $(document).height(),width: $(document).width()});
        }
    },
    addEvent : function(){
        var content_input = $('#resufeContent'), self = this, $reasonM = $('.reasonMore'), $reasonL = $('.reasonLess');
        content_input.focus(function(){
            $(this).val() == self.contentTip ? $(this).val('').addClass('deep') : '';
        });
        content_input.blur(function(){
            var val = $.trim($(this).val());
            if(val == ''){
                $reasonM.hide();
                $(this).removeClass('deep').val(self.contentTip);
            }else if(self.getDoubleByteStrLength(val) > self.contLength){
                content_input.css('border-color', 'red');
                $reasonM.show();
            }else{
                content_input.css('border-color', '');
                $reasonM.hide();
            }
        });
        content_input.keyup(function(){
            var val = $.trim($(this).val());
            if(val == ''){
                $(this).val('');
            }else if(self.getDoubleByteStrLength(val) <= self.contLength){
                content_input.css('border-color', '');
                $reasonM.hide();
            }else if(self.getDoubleByteStrLength(val) > self.contLength){
                content_input.css('border-color', 'red');
                $reasonM.show();
            }
        });
        $('input[type="radio"][name="resufeType"]').click(function(){
            if($(this).val() == '0'){
                content_input.show();
                self.getDoubleByteStrLength(content_input.val()) > self.contLength ?  $reasonM.show() : '';
            }else{
                content_input.hide();
                $reasonM.hide();
            }
            $reasonL.hide();
        });
        $('#btn_ok').click(function(){
            var refuse_type = $('input[type="radio"][name="resufeType"]:checked');
            if(refuse_type.length == 0){
                $reasonL.show();
            }else{
                var content = '', type_text = $('input[type="radio"][name="resufeType"]:checked').siblings().text();
                if(refuse_type.val() == '0'){
                    content = $.trim(content_input.val());
                    if(self.getDoubleByteStrLength(content) > self.contLength){
                        content_input.css('border-color', 'red');
                        $reasonM.show();
                        return;
                    }
                    content = (content == self.contentTip || content == '') ? type_text : content;
                }else{
                    content = type_text;
                }
                self.dataObj.data += '&resufeType=' + refuse_type.val() + '&resufeContent=' + encodeURIComponent(content);
                self.dataObj.target.data('reason', content.replace(/</g, '\<').replace(/>/g, '\>'));
                submitCallback(self.dataObj.data,'UpdateMsgStatus',FEEDBACK.getSubmitResponse,'post',self.dataObj.target);
                $('#btn_close').trigger('click');
                //数据统计埋点
                dyweTrackEvent('feedbackRefuseOption','clickOK');
            }
        });
        $('#refuse_no_reason').click(function(){
            submitCallback(self.dataObj.data,'UpdateMsgStatus',FEEDBACK.getSubmitResponse,'post',self.dataObj.target);
            $('#btn_close').trigger('click');
        });
        $(window).on('resize scroll', function(){
            self.setPosition();
        });
        $('#btn_close').click(function(){
            $('#popupInnerContentspr').remove();
            $('.mask_div_reason').remove();
        });
    },
    getDoubleByteStrLength : function(str){
        //返回包含双字节字符的字符串长度
        if(!str){
            return 0;
        }
        var regexp = /[^\x00-\xff]/, length = 0;
        for(var i = 0, len = str.length; i < len; i++){
            if(regexp.test(str.charAt(i))){
                length += 2;
            }else{
                length += 1;
            }
        }
        return length;
    }
}